﻿using System;

namespace Microsoft.Practices.CompositeUI.Commands
{
    /// <summary>
    /// 	Declares a method as a <see cref = "Command" /> handler.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
    public class CommandHandlerAttribute : Attribute
    {
        #region Fields & Properties

        private readonly string _commandName;

        /// <summary>
        /// 	Gets the name of the <see cref = "Command" /> that the decorated method handles.
        /// </summary>
        public string CommandName
        {
            get
            {
                return _commandName;
            }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// 	Declares a method as a handler for a <see cref = "Command" /> with specified name.
        /// </summary>
        /// <param name = "commandName">The name of the <see cref = "Command" /> the method handles.</param>
        public CommandHandlerAttribute(string commandName)
        {
            _commandName = commandName;
        }

        #endregion
    }
}